<?php


namespace App\Models\ProductCenter\Models;


use App\Models\ProductCenter\ProductModel;

class SizeModel extends ProductModel
{
    public $table = 'size';
    public $fillable = [
        'code',
        'system_id',
        'label', //varchar(16) CHARACTER  NOT NULL DEFAULT '1' COMMENT '类别',
        'value', //varchar(64) CHARACTER  NOT NULL DEFAULT '' COMMENT '尺寸',
        'status',
        'create_user', //varchar(64) CHARACTER  NOT NULL DEFAULT '' COMMENT '创建人',
        'create_user_uuid', //varchar(64) CHARACTER  NOT NULL DEFAULT '' COMMENT '创建人uuid',
//        'create_time', //datetime DEFAULT NULL COMMENT '创建时间',
//        'update_time', //datetime DEFAULT NULL COMMENT '更新时间',
    ];

    public function getSizeList($where, $type)
    {
        $res = $this
            ->handleCondition($where)
            ->orderBy('value');
        if ($type == 1)
            return $res->paginate(config('pageSize'));
        else if ($type == 2)
            return $res->get();
        else if ($type == 3)
            return $res->selectRaw('id,system_id,label,value')->get();
    }
}
